package com.bookstore.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/*
    订单表b_order的实体类
    用于存放订单信息
*/
public class Order {
    private String orderId;//订单编号
    private User uid;//订单商品所属商家
    private User buyers;//订单所属用户
    private List<OrderDetails> orderDetails;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern  = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;//创建时间

    private Integer count;//商品数量
    private Double totalPrice;//订单总价
    private Integer isPay;//是否支付
    private Address addressId;//收获地址
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern  = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date payTime;//付款时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern  = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date deliverTime;//发货时间
    private Integer isDeliver;//是否发货
    private Integer isReceipt;//是否收货
    private Integer isRefund;//是否退款

    @Override
    public String toString() {
        return "Order{" +
                "orderId='" + orderId + '\'' +
                ", uid=" + uid +
                ", buyers=" + buyers +
                ", orderDetails=" + orderDetails +
                ", createTime=" + createTime +
                ", count=" + count +
                ", totalPrice=" + totalPrice +
                ", isPay=" + isPay +
                ", addressId=" + addressId +
                ", payTime=" + payTime +
                ", deliverTime=" + deliverTime +
                ", isDeliver=" + isDeliver +
                ", isReceipt=" + isReceipt +
                ", isRefund=" + isRefund +
                '}';
    }

    public Order(String orderId, User uid, User buyers, List<OrderDetails> orderDetails, Date createTime, Integer count, Double totalPrice, Integer isPay, Address addressId, Date payTime, Date deliverTime, Integer isDeliver, Integer isReceipt, Integer isRefund) {
        this.orderId = orderId;
        this.uid = uid;
        this.buyers = buyers;
        this.orderDetails = orderDetails;
        this.createTime = createTime;
        this.count = count;
        this.totalPrice = totalPrice;
        this.isPay = isPay;
        this.addressId = addressId;
        this.payTime = payTime;
        this.deliverTime = deliverTime;
        this.isDeliver = isDeliver;
        this.isReceipt = isReceipt;
        this.isRefund = isRefund;
    }

    public Integer getIsReceipt() {
        return isReceipt;
    }

    public void setIsReceipt(Integer isReceipt) {
        this.isReceipt = isReceipt;
    }

    public Integer getIsRefund() {
        return isRefund;
    }

    public void setIsRefund(Integer isRefund) {
        this.isRefund = isRefund;
    }

    public Order() {
    }

    public User getBuyers() {
        return buyers;
    }

    public void setBuyers(User buyers) {
        this.buyers = buyers;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public User getUid() {
        return uid;
    }

    public void setUid(User uid) {
        this.uid = uid;
    }

    public List<OrderDetails> getOrderDetails() {
        return orderDetails;
    }

    public void setOrderDetails(List<OrderDetails> orderDetails) {
        this.orderDetails = orderDetails;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(Double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public Integer getIsPay() {
        return isPay;
    }

    public void setIsPay(Integer isPay) {
        this.isPay = isPay;
    }

    public Address getAddressId() {
        return addressId;
    }

    public void setAddressId(Address addressId) {
        this.addressId = addressId;
    }

    public Date getPayTime() {
        return payTime;
    }

    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }

    public Date getDeliverTime() {
        return deliverTime;
    }

    public void setDeliverTime(Date deliverTime) {
        this.deliverTime = deliverTime;
    }

    public Integer getIsDeliver() {
        return isDeliver;
    }

    public void setIsDeliver(Integer isDeliver) {
        this.isDeliver = isDeliver;
    }

    public Order(String orderId, User uid, User buyers, List<OrderDetails> orderDetails, Date createTime, Integer count, Double totalPrice, Integer isPay, Address addressId, Date payTime, Date deliverTime, Integer isDeliver) {
        this.orderId = orderId;
        this.uid = uid;
        this.buyers = buyers;
        this.orderDetails = orderDetails;
        this.createTime = createTime;
        this.count = count;
        this.totalPrice = totalPrice;
        this.isPay = isPay;
        this.addressId = addressId;
        this.payTime = payTime;
        this.deliverTime = deliverTime;
        this.isDeliver = isDeliver;
    }
}
